﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<BlogPlat.Model.Category>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Admin Categories - BlogPlat.NET - .NET Blogging Platform
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
                
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% if (Session["ErrorMessageDelete"] != null) { %>
        <script language="javascript" type="text/javascript">alert("Cannot delete category that has sub category(ies)!");</script>        
    <% Session["ErrorMessageDelete"] = null;
       } %>
    <h2>Categories</h2>

    <table width="1000" cellspacing="1">
        <tr>
            <td colspan="6" class="createtd">
                <%: Html.ActionLink("Create New", "create") %>
            </td>
        </tr>

        <tr>
            <th></th>  
            <th></th>
            <th>Posts</th>         
            <th>
                Parent Category
            </th>
            <th>
                Category Name
            </th>                     
            <th>
                Friendly URL
            </th>                    
        </tr>
        <% 
        int row = 1;
        foreach (var item in Model) { 
            if(row % 2 == 0) { %>                    
                <tr class="even">
                    <% Html.RenderPartial("CategoryListItem", item); %>       
                </tr>
            <% } else { %>
                <tr>
                    <% Html.RenderPartial("CategoryListItem", item); %>       
                </tr>        
            <% }
               row++;
        } %> 
   
    </table>    
</asp:Content>